package com.xiejr.api.interfaces.order;

import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author mobai
 * @since 2021/3/12 09:54
 */
@FeignClient(value = "order",path = "orders",fallback = OrderService.OrderServiceHystrix.class)
public interface OrderService {

    @PostMapping("placeOrder")
    @ApiOperation("下单")
    String placeOrder(@RequestParam("itemId") String itemId,@RequestParam("specId") String specId);

    @Component
    class OrderServiceHystrix implements OrderService{
        @Override
        public String placeOrder(String itemId, String specId) {
            return "服务暂时不可用";
        }
    }
}
